package com.anping.controller.order;

import com.anping.controller.BaseController;
import com.anping.model.Order;
import com.anping.service.OrderService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by admin on 2016/9/18.
 */
@Controller
@RequestMapping("/order")
public class OrderController extends BaseController{
    @Resource
    private OrderService orderService;

    @RequestMapping("/findOrderList")
    public ModelAndView findOrderList(String userName, String orderAddress, Long userTel){
        ModelAndView model = new ModelAndView("/order/orderList");
        try {
            List<Order> orderList = orderService.selectOrderList("".equals(userName)?null:userName, "".equals(orderAddress)?null:orderAddress, userTel);
            model.addObject(orderList);
            model.addObject("userName", userName);
            model.addObject("orderAddress",orderAddress);
            model.addObject("userTel", userTel);
        } catch (Exception e){
            e.printStackTrace();
        }
        return model;
    }

}
